[Statedef -2]

[State -2, Character Detection]
type = VarSet
trigger1 = Cond(NumEnemy,enemynear,AuthorName = "FAMFIGHT" && !Var(1),0)
var(1) = 1

[State -2, AssertSpecial]
type = AssertSpecial
trigger1 = !Var(40)
flag = noairguard

[State -2, StopSnd]
type = StopSnd
trigger1 = RoundState = 2
channel = 1

[State -2, StopSnd]
type = StopSnd
trigger1 = RoundState = 2
channel = 2

[State -2, No Music When Dead]
type = AssertSpecial
trigger1 = (MatchOver) && !alive
trigger2 = RoundState = 3 
trigger3 = LoseTime || WinTime || DrawGame
flag = nomusic

[State -2, Variable for Victory Quote, Default]
type = VarSet
trigger1 = RoundState = 1
var(4) = 0

[State -2, VictoryQuote]
type = VictoryQuote
trigger1 = !Var(4) && RoundState = 4
value = 1+random%3

[State -2, VictoryQuote]
type = VictoryQuote
trigger1 = var(4) = 1
value = 4

[State -2, Command Variable]
type = VarAdd
trigger1 = (command = "fwd" || command = "down" || command = "back" || command = "up") && !var(58)
trigger2 = var(58) < 16  && var(58)
var(58) = 1

[State -2, Command Variable Reset]
type = VarSet
trigger1 = var(58) = 16
trigger2 = (StateNo = [11,4999]) && Time = 1
var(58) = 0

[State -2, Assist Check Reset]
type = VarSet
trigger1 = (StateNo != [1000,1299]) && (StateNo != [4090,4999])
var(53) = 0

[State -2, Hyper Tag-In Check Reset]
type = VarSet
trigger1 = StateNo != [3000,4999]
var(54) = 0

[State -2, HelperPower]
type = VarAdd
triggerall = NumTarget && MoveHit && Var(7) < 150 && HitDefAttr = SCA,NA,SA,NP,SA,NT,ST && !NumHelper(7000)
triggerall = (StateNo != [1010,1049]) && (StateNo != [1060,1099]) && (StateNo != [1110,1149]) && (StateNo != [1160,1199])
trigger1 = HitPauseTime = 1
var(7) = 5
ignorehitpause = 1

[State -2, VarAdd]
type = VarAdd
triggerall = (StateNo >= 1000 && StateNo < 2000) && (StateNo % 5) = 0 && Var(7) < 150 && !NumHelper(7000)
triggerall = (StateNo != [1010,1049]) && (StateNo != [1060,1099]) && (StateNo != [1110,1149]) && (StateNo != [1160,1199]) 
trigger1 = Time = 1
var(7) = 5

[State -2, VarAdd]
type = VarAdd
triggerall = (StateNo = 5000 || StateNo = 5020 || StateNo = 5070) || (StateNo < 5000 & MoveType = H)
triggerall = Var(7) < 150 && !NumHelper(7000)
trigger1 = !Time
var(7) = 3
ignorehitpause = 1

[State -2, VarAdd]
type = VarAdd
triggerall = (StateNo = [150,159]) && Var(7) < 150 && !NumHelper(7000)
trigger1 = !Time
var(7) = 3
ignorehitpause = 1

[State -2, Helper Health]
type = VarSet
trigger1 = NumHelper(850) && TeamMode != Simul
var(6) = 300+200*(var(3) = 0)

[State -2, Helper Health]
type = VarSet
trigger1 = NumHelper(850) && TeamMode != Simul
var(31) = 300+200*(var(3) = 0)

[State -2, VarSet]
type = VarSet
trigger1 = Var(7) > 150
trigger2 = Var(24)
trigger3 = RoundState = 2 && Var(6) = 0
var(7) = 150

[State -2, VarSet]
type = VarSet
trigger1 = Var(24)
var(6) = var(31)

[State -2, VarSet]
type = VarSet
trigger1 = !NumTarget
var(11) = 0

[State -2, VarSet]
type = VarSet
trigger1 = StateNo != [1150,1699]
var(12) = 0

[State -2, VarSet]
type = Null
triggerall = !NumTarget
trigger1 = Var(13) := 0 && Var(17) := 0

[State -2, TargetState]
type = TargetState
triggerall = NumTarget && HitPauseTime
trigger1 = target,Alive = 0 && target,StateNo >= 5000 && target,StateNo < 5070 && Var(1)
value = 25000
ID = -1
ignorehitpause = 1

[State -2, TargetState]
type = TargetState
triggerall = NumTarget && HitPauseTime
trigger1 = target,Alive = 0 && target,StateNo = 5070 && Var(1)
value = 25070
ID = -1
ignorehitpause = 1

[State -2, TargetState]
type = TargetState
triggerall = NumTarget && HitPauseTime && StateNo != [1101,1102]
trigger1 = target,Alive = 0 && target,StateNo = [5080,5111]
value = 25110
ID = -1
ignorehitpause = 1

[State -2, VarSet]
type = VarSet
trigger1 = NumTarget && RoundState = 3
var(14) = 1
ignorehitpause = 1

[State -2, VarSet]
type = VarSet
trigger1 = Var(14) && !NumTarget && RoundState = 3
var(14) = 0
ignorehitpause = 1

[State -2, Nova Whip Target Hitspark]
type = Explod
triggerall = NumTarget(1150)
trigger1 = (target(1150),StateNo = 1154 || target(1150),StateNo = 1162) && target(1150),Time = 1
anim = 6001
ID = 1150
pos = ceil(abs(Pos X - (target(1150),Pos X))+12),-45
postype = p1
removetime = -2
scale = 1,1
sprpriority = 3
ownpal = 1

[State -2, Nova Whip Target PlaySND]
type = PlaySnd
triggerall = NumTarget(1150)
trigger1 = (target(1150),StateNo = 1154 || target(1150),StateNo = 1162) && target(1150),Time = 1
value = F5,2

[State -2, Nova Whip Target Hits]
type = HitAdd
triggerall = NumTarget(1150)
trigger1 = (target(1150),StateNo = 1154 || target(1150),StateNo = 1162) && target(1150),Time = 1
value = 1

[State -2, VarSet]
type = VarSet
triggerall = NumTarget && RoundState = 3
trigger1 = HitDefAttr = SCA,HA,HP,HT && WinKO && HitPauseTime
var(28) = 300+(5*(StateNo >= 3050 && StateNo < 3100))+(10*(StateNo >= 3100 && StateNo < 4000))
ignorehitpause = 1

[State 0, VarAdd]
type = VarSet
trigger1 = RoundState != 3 && Var(28)
var(28) = 0
ignorehitpause = 1
;-------------------------------------------------
[State -2, Debug]
type = DisplaytoClipboard
trigger1 = 1
text = "Vel: x = %f y = %f Star Man by Rukifellth + GDKN + KingPepe. \nPos: x = %f y = %f Version: FamFight TestVar: = %f"
params = Vel X,Vel Y,Pos X,Pos Y,Var(14)
ignorehitpause = 1

[State -2, Vel X]
type = VarSet
trigger1 = 1			
var(21) = 1

[State -2, VarSet]
type = VarSet
trigger1 = !Var(22)
var(22) = 1

[State -2, Training Mode Var]
type = VarSet
triggerall = !RoundsExisted && RoundNo = 1 && MatchNo = 1 && !NumPartner && NumEnemy = 1
trigger1 = (Var(23) <= 30 && Power >= 3000)
var(24) = 1

[State 0, VarAdd]
type = VarAdd
trigger1 = Var(23) <= 30
var(23) = 1		
;-------------------------------------------------
[State -2, Helper Menu]
type = Helper
triggerall = var(1)
triggerall = (!NumHelper(860))
trigger1 = RoundState < 2 && (RoundNo >= 2)
trigger2 = NumPartner && (StateNo = 191) && !Time
name = "Intro"
ID = 860
stateno = 860
pos = 0,0
postype = back
facing = 1
keyctrl = 0
ownpal = 1
supermovetime = 9999
pausemovetime = 9999

[State -2, Helper Menu]
type = Helper
triggerall = var(1)
triggerall = !NumPartner
trigger1 = !NumHelper(8010)
name = "Helper Bars"
ID = 8010
stateno = 8010
pos = 0,0
postype = left
facing = 1
keyctrl = 0
ownpal = 1
supermovetime = 9999
pausemovetime = 9999

[State -2, EXPLODsive Buffering Helper]
type = Helper
trigger1 = !NumHelper(90000005)
helpertype = Normal
stateNo = 90000005
ID = 90000005
name = "EXPLODsive Buffering helper"
posType = P1
facing = ifElse(Facing = 1, 1, -1)
keyCtrl = 1
ignoreHitPause = 1

[State 5900, 2]
type = Helper
trigger1 = !NumHelper(30000) && TeamSide = 1 && RoundState = 2 && !Ctrl && StateNo = 0
name = "Stage Helper"
ID = 30000
stateno = 30000
pos = 0,0
postype = back
facing = 1
keyctrl = 1
ownpal = 0
supermovetime = 9999
pausemovetime = 9999

[State 5900, 2]
type = Helper
trigger1 = !NumHelper(8300) && Var(28)
name = "Super Finish"
ID = 8300
stateno = 8300
pos = 0,0
postype = back
facing = 1
keyctrl = 1
ownpal = 0
supermovetime = 9999
pausemovetime = 9999
ignorehitpause = 1

;-------------------------------------------------
[State -2, VarSet]
type = VarSet
triggerall = NumHelper(800)
trigger1 = helper(800), stateno = 800
var(8) = 1
ignorehitpause = 1

[State -2, VarSet]
type = VarSet
triggerall = NumHelper(800)
trigger1 = helper(800), stateno = 801 || (helper(800), stateno = 804)
var(8) = 0
ignorehitpause = 1
;-------------------------------------------------
[State -2, Combo Counter]
type = VarSet
trigger1 = P2Movetype != H && fvar(20) < 1.00
fvar(20) = 1.00

[State -2, Combo Counter]
type = VarSet
trigger1 = P2Movetype != H && fvar(21) < 1.00
fvar(21) = 1.00

[State -2, Combo Counter]
type = VarSet
trigger1 = P2Movetype = H && fvar(20) < .3
fvar(20) = .3

[State -2, Combo Counter]
type = VarSet
trigger1 = P2Movetype != H && fvar(21) < .3
fvar(21) = .3

[State -2, Combo Counter]
type = VarSet
triggerall = StateNo != 3105 && StateNo != 4005
trigger1 = ((StateNo = [200,699]) || (StateNo = [1000,1999])  || (StateNo = [3000,4000])) && (StateNo % 5) = 0 && Time = 1
fvar(20) = fvar(21)

;-------------------------------------------------
[State -2, Juggle Counter]
type = VarAdd
triggerall = NumTarget && HitCount < 2 && P2StateType = A && HitPauseTime
trigger1 = !var(20) && target,Time = 0
var(5) = 1
ignorehitpause = 1

[State -2, Combo Counter]
type = VarSet
trigger1 = NumPartner
var(5) = partner,Var(5)

[State -2, Combo Counter]
type = VarSet
trigger1 = P2Movetype != H
var(5) = 0

[State -2, Juggle VarAdd]
type = VarAdd
trigger1 = NumHelper(7050)
trigger1 = helper(7050),Var(0)
var(5) = 1
ignorehitpause = 1
;-------------------------------------------------
[State -2, RemoveExplod]
type = RemoveExplod
triggerall = NumEnemy
trigger1 = Var(8)|| enemy,Var(8)
trigger2 = NumHelper(6002) || enemy,NumHelper(6002)
trigger3 = NumHelper(8300)
id = 8030
ignorehitpause = 1
;-------------------------------------------------
[State -2, Special Projectile X-Coordinate]
type = VarSet
trigger1 = NumHelper(1000)
fvar(30) = helper(1000),fvar(1)

[State -2, Special Projectile Y-Coordinate]
type = VarSet
trigger1 = NumHelper(1000)
fvar(31) = helper(1000),fvar(2)

[State -2, Super Projectile X-Coordinate]
type = VarSet
trigger1 = NumHelper(3000)
fvar(32) = helper(3000),fvar(1)

[State -2, Super Projectile Y-Coordinate]
type = VarSet
trigger1 = NumHelper(3000)
fvar(33) = helper(3000),fvar(2)

[State -2, Helper Projectile X-Coordinate]
type = VarSet
trigger1 = NumHelper(7050)
fvar(34) = helper(7050),fvar(1)

[State -2, Helper Projectile Y-Coordinate]
type = VarSet
trigger1 = NumHelper(7050)
fvar(35) = helper(7050),fvar(2)

[State -2, Helper X-Coordinate]
type = VarSet
trigger1 = NumHelper(7000)
fvar(36) = helper(7000),fvar(1)

[State -2, Helper Y-Coordinate]
type = VarSet
trigger1 = NumHelper(7050)
fvar(37) = helper(7050),fvar(2)

[State -2, Special Projectile X-Coordinate Reset]
type = VarSet
trigger1 = !NumHelper(1000)
fvar(30) = 0

[State -2, Special Projectile Y-Coordinate Reset]
type = VarSet
trigger1 = !NumHelper(1000)
fvar(31) = -999

[State -2, Super Projectile X-Coordinate Reset]
type = VarSet
trigger1 = !NumHelper(3000)
fvar(32) = 0

[State -2, Super Projectile Y-Coordinate Reset]
type = VarSet
trigger1 = !NumHelper(3000)
fvar(33) = -999

[State -2, Helper Projectile X-Coordinate Reset]
type = VarSet
trigger1 = !NumHelper(7050)
fvar(34) = 0

[State -2, Helper Projectile Y-Coordinate Reset]
type = VarSet
trigger1 = !NumHelper(7050)
fvar(35) = -999

[State -2, Helper X-Coordinate Reset]
type = VarSet
trigger1 = !NumHelper(7000)
trigger2 = NumHelper(7000)
trigger2 = (helper(7000),StateNo = [7020,7059]) || (helper(7000),StateNo = [7120,7159]) || (helper(7000),StateNo = [7220,7259])
fvar(36) = -999

[State -2, Helper Y-Coordinate Reset]
type = VarSet
trigger1 = !NumHelper(7000)
trigger2 = NumHelper(7000)
trigger2 = (helper(7000),StateNo = [7020,7059]) || (helper(7000),StateNo = [7120,7159]) || (helper(7000),StateNo = [7220,7259])
fvar(37) = -999

[State -2, Projectile Reaction]
type = Null
triggerall = StateNo = 1000 || StateNo = 1010 || StateNo = 3000
trigger1 = Time >= 5
var(52) = 1

[State -2, Projectile Reaction]
type = Null
trigger1 = StateNo != 1000 || StateNo = 1010 || StateNo = 3000
var(52) = 0
;-------------------------------------------------
[State -2, Intro Countdown]
type = VarAdd
triggerall = RoundState = 1 && StateNo = 0 && Cond(NumEnemy,enemy, StateNo = 0 && Cond(NumPartner, partner,StateNo = 0, 1),0)
trigger1 = Var(32) > 0
var(32) = -1

[State -2, AssertSpecial]
type = AssertSpecial
trigger1 = Var(32) > 0 && Cond(NumEnemy,(enemy,Name != "BONUS" || TeamSide = 2),0)
flag = intro

[State -2, VarSet]
type = VarSet
trigger1 = (RoundState = 2) || Cond(NumEnemy,(enemy,Name = "BONUS" && TeamSide = 1),0)
var(32) = 0
;-------------------------------------------------
[State -3, VarAdd]
type = VarAdd
trigger1 = Var(0) > 0 || (Var(0) > 20 && Var(0) <= 30)
var(0) = -1
ignorehitpause = 1

[State -3, VarAdd]
type = VarSet
trigger1 = Var(0) > 11 && Var(0) <= 20
var(0) = 0
ignorehitpause = 1

;-------------------------------------------------
; ---------------------------------------------------------
;   ----- Uno Tag System v.2.5 STATEDEF -2 Override -----
; ---------------------------------------------------------
;
; Uno Tag System ver.2.5 by UnoShe
; - PLEASE GIVE CREDIT IF MODIFYING THIS..
;
[State -2, deactivate tag]
type = VarSet
triggerall = Numpartner
triggerall = var(51) > 0
triggerall = var(51) != 6
trigger1 = roundstate > 2
trigger1 = Win || Lose
trigger2 = Roundstate < 1
;trigger2 = teammode = Simul
trigger2 = !partner, var(51)
trigger2 = Time = [1,2]
trigger3 = Numpartner
trigger3 = Partner, var(51)
trigger3 = !Life
v = 51
value = 0

[State -2, def_partner]
type = VarSet
triggerall = Numpartner
trigger1 = roundstate < 1
trigger1 = time = [0,1]
v = 51
value = (1 + ((ID > Partner, ID)*4))

; Tag active definer
[State -2, def]
type = VarSet
triggerall = NumPartner
trigger1 = var(51) = 8
trigger1 = !(Partner, Life)
trigger2 = (Partner, StateNo = [4910,4912]) || Partner, StateNo = 4914
trigger2 = var(51) != [2,9] 
trigger3 = var(51) = 5
trigger3 = Roundstate = 2
trigger3 = Stateno = [4911,4912]
trigger4 = (Partner, StateNo != [4910,4912]) || Partner, StateNo = 4914
trigger4 = Var(51) = 10 || Var(51) = 11 
v = 51
value = 1

[State -2, Uno]
type = ParentVarSet
trigger1 = PrevStateNo = 4906
v = 51
value = 7

[State -2, Angat!] 
type = Null
triggerall = NumTarget
triggerall = NumPartner
triggerall = var(51) = 8
triggerall = stateno != [4901,4933]
triggerall = prevstateno = 4933
trigger1 = target, Statetype != S
trigger1 = Target, HitVel Y < 2
trigger1 = MoveHit || (NumProj > 0 && ProjHit = 1, < 30)
trigger1 = Target, Pos Y > -50
trigger1 = !(Target, StateNo >= 5050)
trigger2 = Target, Hitfall
trigger2 = MoveHit || (NumProj > 0 && ProjHit = 1, < 30)
trigger2 = Target, Pos Y > -50
trigger2 = !(Target, StateNo >= 5050)
x = -0.1
y = -8
persistent = 0

[State -2, Eksena]
type = ScreenBound
triggerall = NumPartner
trigger1 = Partner, var(51) = 4
trigger1 = stateno = 4931 || prevstateno = 4931
value = 1
movecamera = 1,1

[State -2, def]
type = VarSet
triggerall = NumPartner
trigger1 = partner, time = [0,1]
trigger1 = Partner, Stateno = 4904
trigger2 = partner, time = [0,1]
trigger2 = Partner, Stateno = 4910
trigger2 = StateNo != [4901,4928]
v = 51
value = 1

[State -2, GTG]
type = SelfState
triggerall = NumPartner
trigger1 = Life && Partner, Life
trigger1 = PrevStateno = 4926
trigger1 = stateno != 4911
value = 4911
ignorehitpause = 1

[State -2, Oh No!]
type = SelfState
trigger1 = prevstateno = 4912 || prevstateno = 4914
trigger1 = !(stateno = [4901,4933])
value = 4912
ctrl = 0

[State -2, PowerReset]
type = poweradd
trigger1 = var(51) = 5
trigger1 = RoundNo < 2
trigger1 = RoundState < 2
trigger1 = time = 0
value = -Power
persistent = 0

[State -2, PowerAdd]
type = Null
trigger1 = var(51) = 5 && power < 900
trigger1 = RoundNo < 2
trigger1 = RoundState < 2
trigger1 = time = 1
value = 1000
persistent = 0

; Tag active ctrl
[State -2, ctrl]
type = SelfState
triggerall = Numpartner
trigger1 = Partner, var(51)
trigger1 = !Var(51)
trigger1 = var(51) != 8 && Partner,var(51) != 8
trigger1 = StateNo != 5900
trigger1 = partner, var(51) != [2,8]
trigger1 = RoundState = 2
trigger1 = Life && Partner, Life
trigger1 = stateno != [1000,4999]
value = 4912
ctrl = 0


;---------------------------------------------------------------------------
[Statedef -3]

[State -3, Jump]
type = PlaySnd
triggerall = StateNo = 50
trigger1 = Time = 1
value = S40,0

[State -3, Jump]
type = PlaySnd
triggerall = StateNo = 5150
trigger1 = Time = 1
value = S11,1

[State -3, Pause Menu]
type = Helper
triggerall = (!AILevel) && !(NumHelper(800)) && (RoundState = 2)
trigger1 = command = "start" && (!HitPauseTime || HitPauseTime = 1) && !NumHelper(6002)
name = "Pause Menu"
ID = 800
stateno = 800
pos = 0,0
postype = left
facing = 1
keyctrl = 1
ownpal = 1
pausemovetime = 999999
ignorehitpause = 1

[State -3, VarSet]
type = ChangeState
triggerall = NumTarget && StateNo != 1009
trigger1 = target,StateNo = 1163
value = 1009
ignorehitpause = 1

;-------------------------------------------------
[State -3, VarSet]
type = VarSet
triggerall = !NumPartner && !NumHelper(7000) && !NumHelper(7050) && !Var(0)
triggerall = !Var(0) && (Var(7) >= ((50+50*(Var(3) = 0))+50)) && ((StateNo = [200,699]) || (StateNo = [1000, 1999]) || (StateNo = [3000,4999]))
trigger1 = !Var(59) && NumExplod(90000250) && !(NumExplod(90000002) || NumExplod(90000003) || NumExplod(90000001))
var(0) = 11
ignorehitpause = 1

[State -3, VarSet]
type = VarSet
triggerall = !NumPartner && !NumHelper(7000) && !NumHelper(7050) && !Var(0)
triggerall = !Var(0) && (Var(7) >= ((50+50*(Var(3) != 2))+50)) && ((StateNo = [200,699]) || (StateNo = [1000, 1999]) || (StateNo = [3000,4999]))
trigger1 = !Var(59) && NumExplod(90000250) && (NumExplod(90000002) || NumExplod(90000003) || NumExplod(90000001))
var(0) = 32
ignorehitpause = 1

[State -3, VarSet]
type = VarAdd
trigger1 = Var(0) = 11
var(7) = -100-(50*(Var(3) = 0))
ignorehitpause = 1

[State -3, VarSet]
type = VarAdd
trigger1 = Var(0) = 32
var(7) = -100-(50*(Var(3) != 2))
ignorehitpause = 1

[State -3, PalFX]
type = PalFX
trigger1 = Var(0) = 11 || Var(0) = 32
time = 3
add = 256, 256, 256
mul = 256,256,256
invertall = 0
color = 256
ignorehitpause = 1

[State -3, PlaySnd]
type = PlaySnd
trigger1 = Var(0) = 11 || Var(0) = 32
value = F799,0
ignorehitpause = 1

[State -3, Helper]
type = Helper
trigger1 = !NumHelper(7000) && (Var(0) = 11 || Var(0) = 32)
name = "Helper"
ID = 7000
stateno = 7000+(100*Var(3))+(10*(Var(0) > 20))
pos = -50,0
postype = back
facing = 1
ownpal = 1
ignorehitpause = 1

; ---------------------------------------------------------
;   ----- Uno Tag System v.2.5 STATEDEF -3 Override -----
; ---------------------------------------------------------
;
; Uno Tag System ver.2.5 by UnoShe
; - PLEASE GIVE CREDIT IF MODIFYING THIS..

[State -3, enterTheScreen]
type = ChangeState
triggerall = Numpartner
trigger1 = var(51)
trigger1 = stateno = [4912,4914]	
trigger1 = Life 
trigger1 = (partner, stateno = 4911) || (partner, stateno = 4925 && partner, time > 0)
value = 4901

; Appear into the screen (Tag Hyper Cancel)
[State -3, enterTheScreen]
type = ChangeState
triggerall = Numpartner
trigger1 = var(51)
trigger1 = stateno = 4912 || stateno = 4914
trigger1 = (partner, stateno = 4927 && partner, time > 1) || (partner, prevstateno = 4927)
trigger1 = Life
value = 4931

; Jump into the screen (Change Attack)
[State -3, enterTheScreen]
type = ChangeState
triggerall = Numpartner
triggerall = var(51)
trigger1 = stateno = 4912 || stateno = 4914
trigger1 = (partner, stateno = 4926 && partner, time > 0)
trigger1 = Life
value = 4902

; Jump into the screen (Game is OVER)
[State -3, enterTheScreen]
type = ChangeState
triggerall = var(51)
triggerall = NumPartner
triggerall = Life
triggerall = StateNo = [4912,4914]
trigger1 = roundstate >= 3
trigger1 = Win || LoseTime || WinTime || drawgame
value = 4920

[State -3, NoJC]
type = AssertSpecial
trigger1 = prevstateno = [4912,4933]
flag = nojugglecheck
ignorehitpause = 1

[State -3, RemoveExplod]
type = Null
trigger1 = StateNo = [4910,4913]
trigger2 = !Life

[State -3, cancelfx]
type = Null
triggerall = Time = [0,6]
trigger1 = StateNo = 4902 || StateNo = 4926
time = ifelse(StateNo = 4902,3,6)
add = (25 + Time*3), (25 + Time*3), (655 - Time*5)
mul = 250, 250, (125 + Time)
sinadd =-245, -245, -250, (40 + Time*3)

[State -3, Quiet]
type = AssertSpecial
trigger1 = NumPartner
trigger1 = Partner, var(51) = 7
trigger1 = !Alive && !NumHelper(4930)
flag = nokosnd

[State -3, Dark]
type = AssertSpecial
triggerall = NumPartner
trigger1 = StateNo = 4906
trigger2 = Stateno = 4927 || Partner, Stateno = 4927
trigger3 = NumHelper(4901) || StateNo = 4931
flag = noBG
flag2 = noFG
flag3 = timerfreeze
ignorehitpause = 1

[State -3, InvertBG]
type = Null;AllPalFx
trigger1 = NumHelper(4930)
time = 2
invertall = 0
color = 225

[State -3, Invert]
type = Null
trigger1 = PrevStateNo = [4928,4929]
trigger2 = Stateno = 4906 && !NumHelper(4907)
time = 10
invertall = 1
mul = 200, 200, 200

[State -3, SuperPause]
type = SuperPause
triggerall = NumPartner
trigger1 = Partner, StateNo = 4906
trigger1 = NumHelper(4930)
trigger2 = NumHelper(4901)
time = 10
anim = -1
sound = -1
movetime = 10
darken = 0
p2defmul = 0
unhittable = 1
pausebg = 1

[State -3, TargetVelAdd]
type = TargetVelAdd
triggerall = NumPartner
triggerall = Numtarget
trigger1 = !(Target, StateNo = [4916,4917]) && !(Target, PrevStateNo = [4916,4917])
trigger1 = Roundstate = 2
trigger1 = prevstateno = 4926
trigger1 = partner, stateno = 4902 && !(partner, movecontact)
trigger1 = target, statetype != A && target, GetHitVar(xvel) < 0
x = 0.15

;-- Enable CA again..
[State -2, def]
type = VarSet
triggerall = var(51) = 9
trigger1 = Numtarget = 0
trigger2 = Time >= 9 * TicksPerSecond
v = 51
value = 1

[State -3, No AirGuard]
type = AssertSpecial
triggerall = Numpartner
trigger1 = var(51) = 8
trigger1 = Movetype = A
trigger1 = prevstateno = 4933
flag = Noairguard
flag2 = nojugglecheck
flag3 = nowalk
ignorehitpause = 1

[State -3, Can't be throw]
type = Nothitby
trigger1 = Numpartner
trigger1 = var(51) = 8
trigger1 = stateno != 4912 || stateno != 4914
value = , AT

[State -3, leavethem]
type = ChangeState
triggerall = var(51) = 8
triggerall = StateType != A
triggerall = Numpartner
trigger1 = Roundstate = 2
trigger1 = Life && partner, life
trigger1 = Partner, Stateno != [4901,4935]
trigger1 = MoveType = I || StateNo = [5100,5950]
trigger1 = Stateno != [1000,4999]
value = ifelse(((prevstateno=[5000,5950]) || (anim=[5000,5950])),4911,4910)
ctrl = 0

[State -3, leaveIntro]
type = ChangeState
triggerall = var(51) = 5
trigger1 = Numpartner
trigger1 = Roundstate >= 2
trigger1 = Stateno != [1000,4999]
value = 4910
ctrl = 0

[State -3, fromdark]
type = helper
trigger1 = Var(51) = 7 && !NumHelper(4939)
trigger1 = PrevStateNo = 4906 || StateNo = 5300
trigger1 = Time <= 25
helpertype = Normal
ID = 4939
stateno = 4930
name = "dark"
ownpal = 1
supermovetime = 9999
pausemovetime = 9999

[State -3, Buwelo]
type = PosFreeze
trigger1 = Prevstateno = 4902
trigger1 = var(51) = 9
trigger1 = (Anim != [42,45])
trigger1 = Time <= 6
trigger1 = Numpartner
trigger1 = StateType = A 
trigger1 = MoveType = A

[State -3, sb_PA]
type = ScreenBound
trigger1 = Numpartner
trigger1 = var(51) = 8
value = ifelse(MoveType = A,1,0)

[State -3, No Ctrl]
type = CtrlSet
triggerall = Numpartner
trigger1 = stateno != [4911,4914]
trigger1 = var(51) = 8
value = ifelse((Partner, Alive),0, 1)

[State -3, Interrupt_PA]
type = ChangeState
triggerall = var(51) = 8
triggerall = NumPartner
trigger1 = stateno != [4900,4999]
trigger1 = prevstateno = [5000,5500]
trigger1 = movetype != H
trigger1 = partner, life > 0 && !Win && !Lose
value = 4911

[State -3, Party]
type = CtrlSet
triggerall = NumPartner
trigger1 = Partner, stateno != [4910,4913]
trigger1 = Partner, var(51) = 2
trigger1 = Movetype != A
trigger1 = prevstateno != [5000,5500]
value = ifelse((partner, movetype = A), 0, Cond((prevstateno = [4932,4931]) || (partner, stateno = 4925),0,1))

[State -3, PartyDone]
type = CtrlSet
triggerall = NumPartner
triggerall = !Ctrl
triggerall = Movetype != A
triggerall = stateno != [1000,5600]
trigger1 = prevstateno = [5000,5600]
trigger1 = Partner, var(51) = 2
trigger2 = Partner, Stateno = 4911
trigger2 = Partner, var(51) = 2
value = 1

[State -3, fadeOut]
type = Null
triggerall = NumPartner
trigger1 = !Life && Partner, Life
trigger1 = Partner, var(51)
trigger1 = RoundState = 2
trigger1 = StateNo = [5110,5150]
trigger1 = Time < ifelse((Partner,var(51) = 7),128,256)
trans = addalpha
alpha = 256-Cond((Partner,var(51) = 7),(time *3),time*2), time*time

[state -3, dead_var]
type = varset
triggerall = NumPartner
triggerall = !Alive
triggerall = RoundState = 2
triggerall = StateNo = [5110,5150]
trigger1 = Partner, Var(51)
trigger1 = time >= 128
trigger2 = Partner, Var(51)
trigger2 = Partner, var(51) = 7
trigger2 = time >= 85
v = 51
value = 6

[state -3, awake_var]
type = varset
triggerall = NumPartner
triggerall = roundstate = 2
trigger1 = Alive
trigger1 = var(51) = 6
trigger2 = Partner, Life
trigger2 = var(51) = 7
v = 51
value = 1

[state -3, offME]
type = NotHitBy
triggerall = NumPartner
trigger1 = var(51) = 6
trigger2 = StateNo = 4928 || PrevStateNo = 4928
trigger3 = Partner, var(51) = 6
trigger3 = StateNo = [4901,4933]
value = SCA

[state -3, disappear2]
type = ChangeState
trigger1 = RoundState = 2
trigger1 = StateNo = [5110,5149]
trigger1 = var(51) = 6
value = 4913

[state -3, Ghost]
type = AssertSpecial
triggerall = !Alive
triggerall = RoundState >= 2
triggerall = var(51) = 6
trigger1 = Anim = [5000,5600]
trigger2 = PrevStateNo = [4913,4921]
flag = invisible
flag2 = noshadow
ignorehitpause = 1

[State -3, drop]
type = TargetDrop
trigger1 = NumTarget
trigger1 = !Life

[State -3, EndLife]
type = LifeAdd
triggerall = RoundState = 2
trigger1 = PrevStateNo = 4929
trigger2 = Var(51) = 6
value = -LifeMax

; ------------------- UNO MODE --------------------
[State -3, Cursed]
type = LifeAdd
triggerall = NumPartner
trigger1 = RoundState = 2
trigger1 = Stateno != 4906
trigger1 = !(Partner, Life)
trigger1 = (gametime%10) = 0
trigger1 = var(51) = 7
value = (-5 + Cond(Life < LifeMax/6, 3, 0))

[State -3, Cursed_2]
type = PowerAdd
triggerall = NumPartner
trigger1 = RoundState = 2
trigger1 = Stateno != 4906
trigger1 = !(Partner, Life)
trigger1 = var(51) = 7
trigger1 = Power < PowerMax
trigger1 = MoveType != A
value = 100

[State -2, Cursed_3]
type = AttackMulSet
triggerall = NumPartner
trigger1 = RoundState = 2
trigger1 = !(Partner, Life)
trigger1 = var(51) = 7
value = (1.5 + ((LifeMax/Life) * 0.015))

[State -3, Cursed_4]
type = DefenceMulSet
triggerall = NumPartner
trigger1 = RoundState = 2
trigger1 = !(Partner, Life)
trigger1 = var(51) = 7
value = ifelse((Life>150),(0.2 - ((LifeMax/Life) * 0.015)),0.1)

[State -2, Cursed_5]
type = AssertSpecial
triggerall = NumPartner
trigger1 = RoundState = 2
trigger1 = MoveType = A
trigger1 = var(51) = 7
flag = nojugglecheck
flag2 = nowalk
ignorehitpause = 1

[State -3, Cursed_new1]
type = CtrlSet
triggerall = NumPartner
triggerall = RoundState = 2
triggerall = Numtarget
triggerall = StateNo != 4906
trigger1 = Target, StateNo != [200,4900]
trigger1 = (Partner, StateNo != [4928,4929]) && (Partner, PrevStateNo != [4928,4929])
trigger1 = var(51) = 7
trigger1 = Movetype = A
trigger1 = MoveContact
trigger1 = hitdefattr = SCA, NA, SA
trigger1 = hitcount < 6 && StateNo != PrevStateNo
trigger1 = Time > 3
trigger2 = Target, StateNo != [200,4900]
trigger2 = (Partner, StateNo != [4928,4929]) && (Partner, PrevStateNo != [4928,4929])
trigger2 = PrevStateNo = 4906
value = 1
ignorehitpause = 0

[State -3, Cursed_new2]	; Die if TIMEOVER!
type = LifeAdd
triggerall = NumPartner
trigger1 = RoundState > 2 && !Win
trigger1 = Stateno != 4906
trigger1 = !(Partner, Life)
trigger1 = var(51) = 7
value = -(Life)

[State -3, Cursed_effect1]
type = Null
trigger1 = NumPartner
trigger1 = Stateno != 4906
trigger1 = RoundState = 2
trigger1 = !Win && !Lose && !MatchOver && !DrawGame
trigger1 = !NumHelper(4907)
trigger1 = var(51) = 7
add=(50+Random*0.15),(50+Random*0.12),(50+Random*0.12)
mul = (90+Random*0.125), (90+Random*0.125), (90+Random*0.125)
sinadd=-255,-245,-245,(40 + Time*2)
time=10

[State -3, Cursed_effect2]
type = Null
triggerall = RoundState <= 2
triggerall = !Win && !Lose && !MatchOver && !DrawGame
triggerall = var(51) = 7
trigger1 = PrevStateNo = 5300 || PrevStateNo = 4600
trigger2 = (gametime%10) = 0
trans = add
PalContrast =  250, 250, 250
PalBright = 0,0,0
time    =  -1
length  = 17
TimeGap = 1
FrameGap = 1

[State -3, Cursed_effect2]
type = Null
triggerall = RoundState > 2
trigger1 = var(51) = 7
trigger2 = !Alive
time = 0

[State -3, Cursed_KOed]
type = SelfState
triggerall = var(51) = 7
trigger1 = !Life
trigger1 = StateType != A
trigger1 = StateNo != [5000,5600]
value = 5950
; ------------------------------------

[State -3, wait out of the stage]
type = ChangeState
triggerall = NumPartner
triggerall = RoundState = 2
triggerall = Life && Partner, Life	; And you're alive
triggerall = stateno != [4910,4913]
trigger1 = var(51) = 2            ; just performed team attack
trigger1 = (stateno != [1000,4999]) && (MoveType != H)
trigger2 = var(51) = 2            ; just performed team attack
trigger2 = (PrevStateNo = [5000,5500]) && (MoveType != H)
trigger3 = var(51) = 4            ; just performed Tag Cancel
trigger3 = (partner, prevstateno = 4931) && time > 1
trigger4 = var(51) = 3            ; just performed Shift Attack
trigger4 = (stateno = 4926 && time > 1) && (partner, stateno = 4902)
trigger5 = partner, stateno = 4903 && partner, time > 1
value = ifelse(var(51) = 4, 4912, 4911) 
ctrl = 0
ignorehitpause = 1

[State -3, Reset]
type = VarSet
trigger1 = StateNo != [4912, 4914]
var(55) = 0

[State -3, Reset]
type = VarSet
trigger1 = StateNo != [4912, 4914]
var(56) = 0

[State -3, Reset]
type = VarSet
trigger1 = StateNo != [4912, 4914]
var(57) = 0
; ---------- Uno Tag System v.2.5 END LINE Statedef -3 ----------
